home *** CD-ROM | disk | FTP | other *** search
- I thought I sent this to the list, but apparently not.
-
- Does this sound more feasible than all the If Else statements?
-
- TSI digitized on 09-Mar-98 14:03:31:
- > Hey all,
- > I'm a little worried about asking this question seeing as everyone
- > has a short fuse on this list, but here goes..
-
- Oh, only eric causes that effect :)
-
- > I'm too aquainted with extensions, but I'm under the impression
- > that they are "add-ins" for amos.. right? Now, I have 2 pc's <it
- > take 2 to equal 1 amiga ;) > and I do some coding in Visual Basic
- > <if you can call that coding>, one feature I like from VB is the
- > SELECT CASE thingy.. I've been looking at alot of my AMOS coding
- > and I see alot of "if x = "XXX" then... : if x = "YYY" then..."
- > statements and I could save myself alot of coding if AMOS had the
- > SELECT CASE statement. Would it be possible for someone to make an
- > extension to allow that? For those of you who don't know how SELECT
- > CASE works..
-
- > IF.. THEN Statements:
- > ---
- > INPUT X$
-
- > IF X$ = "Hello" THEN PRINT "Hello right back, Buddy!!!"
- > IF X$ = "Goodbye" THEN PRINT "Ok, seeya!!!"
- > ---
-
- > SELECT CASE statements:
- > ---
- > INPUT X$
-
- > SELECT CASE X$
- > CASE "hello"
- > PRINT "Hello right back, Buddy!!!"
- > CASE "Goodbye"
- > PRINT "Ok, seeya!!!"
- > END SELECT
- > ---
-
- No extension. BASIC Amos:
-
- You can use: ON X GOTO/GOSUB
- It's similar to a SWITCH (X$)/CASE in C.
-
- --
-
- XT$="hg" : Rem It's quicker to define the string when
- ' you will use it often.
- ' And it's easier to change :)
-
-
- _Choice:
- Y$=Lower$(Left$(X$,1))
- X=Instr(XT$,X$)
- On X Goto _Hello,_Goodbye
- ' X= 1 or 2, not 0 or 1
- ' I use GOTO so there's no RETURN to here.
- ' The next RETURN will go back to the
- ' calling function.
- ' This is a fallback statement.
- ' INSTR will set X=0 so you know that
- ' the INSTRing search was unsuccessful.
- Print "Command not recognized"
- Return
-
- _Hello:
- Print "Hello right back, Buddy!!!"
- Return
-
- _Goodbye:
- Print "Ok, seeya!!!"
- Return
-
- --
-
-
- Greets,
- - Rand
- --
- ______ ________________________ ////
- | _ \ _____ ___ __ _____ mailto:rand@netwave.net ////
- | [_} )(___ \ ( \ | ( _ \ http://www.netwave.net/members/rand
- | _ ( / __ \ | \| | |_} ) ////
- |__| \___)(_______(__|\____(_____/ \\\\////
-
-
- * <-- Tribble {{* <-- Klingon tribble
-
-
-